package com.me.forum.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.me.forum.dao.IPageTypeDao;
import com.me.forum.domain.Category;
import com.me.forum.domain.PageType;
import com.me.forum.domain.User;
import com.me.forum.request.CategoryRequest;
import com.me.forum.request.PageRequest;
import com.me.forum.request.PageTypeRequest;
import com.me.forum.request.UserRequest;
import com.me.forum.service.IPageTypeService;
import org.springframework.stereotype.Service;

@Service
public class PageTypeService extends BaseService<IPageTypeDao, PageType> implements IPageTypeService {

    public IPage<PageType> getPageType(PageTypeRequest ureq, String page, String size) {
        return dao.selectByAll(new Page<PageType>(Long.valueOf(page),Long.valueOf(size)),ureq);
    }


    public boolean addPageType(PageTypeRequest preq) {
        if (!preq.isLegal()) {
            return false;
        }
        boolean save = dao.insertSelective(preq);

        return save ;
    }


    public boolean UpdatePageType(PageTypeRequest preq) {
        if (!preq.isLegal()) {
            return false;
        }
        return dao.updateByPageType(preq) == 1;
    }

}
